package main

import "fmt"

func maxDepth(s string) int {
	res, brackets := 0, 0
	for _, v := range s {
		if v == '(' {
			brackets++
			if brackets > res {
				res = brackets
			}
		} else if v == ')' {
			brackets--
		}
	}
	return res
}

func main() {
	fmt.Println(maxDepth("(1+(2*3)+((8)/4))+1"))
	fmt.Println(maxDepth("(1)+((2))+(((3)))"))
	fmt.Println(maxDepth("1+(2*3)/(2-1)"))
}
